import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useNotePageStore = defineStore(
  'notePage',
  () => {
    // 是否进行了子级路由的跳转
    const pageState = ref(false)
    const setPageState = (flag) => (pageState.value = flag)
    // 绑定的父级文件夹名
    const fatherFiled = ref('')
    const setFatherFiled = (str) => (fatherFiled.value = str)
    // 是否删除了父级文件夹
    const empty = ref(false)
    const setEmpty = () => (empty.value = !empty.value)
    // 是否完成了上传
    const upIsOk = ref(false)
    const setUpIsOk = () => (upIsOk.value = !upIsOk.value)
    return {
      pageState,
      fatherFiled,
      empty,
      upIsOk,

      setPageState,
      setFatherFiled,
      setEmpty,
      setUpIsOk
    }
  },
  {
    persist: true
  }
)
